'use strict'

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    const { INTEGER, STRING, TEXT, BOOLEAN, DATE } = Sequelize
    await queryInterface.createTable('works_comment', {
      id: {
        type: INTEGER(20).UNSIGNED,
        primaryKey: true,
        autoIncrement: true,
        allowNull: false,
        comment: '主键id'
      },
      works_id: {
        type: INTEGER(20).UNSIGNED,
        allowNull: false,
        comment: '留言的标签id'
      },
      content: {
        type: TEXT,
        allowNull: false,
        comment: '留言内容'
      },
      username: {
        type: STRING(50),
        allowNull: false,
        comment: '留言用户名'
      },
      avatar_type: {
        type: INTEGER,
        allowNull: false,
        comment: '留言用户头像类型'
      },
      status: {
        type: BOOLEAN,
        allowNull: false,
        defaultValue: 1,
        comment: '状态 1:正常 0:删除'
      },
      created_at: DATE,
      updated_at: DATE
    })
  },

  async down(queryInterface) {
    queryInterface.dropTable('works_comment')
  }
}
